<template>
  <div class="base-echart">
    <div ref="echartDivRef" :style="{ width, height }"></div>
  </div>
</template>

<script lang="ts">
import { defineComponent, onMounted, ref, watchEffect } from 'vue'
import useEchart from '../hooks/useEchart'

export default defineComponent({
  props: {
    option: {
      type: Object,
      default: () => ({})
    },
    width: {
      type: String,
      default: '100%'
    },
    height: {
      type: String,
      default: '360px'
    }
  },
  setup(props) {
    const echartDivRef = ref<HTMLElement>()

    onMounted(() => {
      const { setOptions } = useEchart(echartDivRef.value!)
      const dataList: any = props.option

      watchEffect(() => {
        // setOptions(dataList)
      })
    })
    return {
      echartDivRef
    }
  }
})
</script>

<style scoped></style>
